//
//  LDMessageDataManager.swift
//  DingDongZP
//
//  Created by 三秒文化 on 16/6/2.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

import UIKit
import FMDB


class LDMessageDataManager: NSObject {

    //
    var databaseQueue:FMDatabaseQueue?
    
    func getDatabaseQueue() ->FMDatabaseQueue?{
        
        if RCIMClient.sharedRCIMClient().currentUserInfo == nil {
            
            return nil
        }
        
        if databaseQueue == nil {
            var onceToken = dispatch_once_t()
            
            dispatch_once(&onceToken, { [weak self] in
                let paths:NSString = NSString(string: LDCache.JobFinderInfoMessage)
                
                self?.databaseQueue = FMDatabaseQueue.init(path: paths.stringByAppendingPathComponent(String(format: "MessageInfoDB_%@",RCIMClient.sharedRCIMClient().currentUserInfo.userId)), flags: 11)
            })
        }
        return databaseQueue
        
    }
    
    //创建用户储存表

   
    //入口
    class var shareInstance:LDMessageDataManager{
        
        struct Instance {
            static let instance = LDMessageDataManager()
        }
        return Instance.instance
    }
    
    
    private override init() {
        super.init()
    }
}
